<!doctype html>
<html>
{include file="head.html"}

<body>
<div class="header" > <a  class="left-btn pointer" href="{$appkucun}?m=kcorder"><span class="iconfont icon-back"></span></a>
  <div class="title">进货</div>
</div>
<div class="main-body">
	
    

  
  <div class="index-hd">{$site.sitename}</div> 
  <table class="kdtable" width="100%">
    {foreach item=p from=$order_product}
    <tr>
      <td style="width:60px;"><img src="{$p.imgurl|images_site}.100x100.jpg" width="50" /></td>
      <td class="km"><div class="hd">{$p.title}</div>
       
         <div>下单价：{$p.gys_price} 
        共<span class="buy_num">{$p.buy_num}</span>件 {if $data.status eq 0}<a href="javascript:;" class="chnum" url="{$appkucun}?m=kcorder&a=pronum&ajax=1&order_id={$data.order_id}&productid={$p.productid}&num=-1"  style="color:red">减数量</a>
        
        <a href="javascript:;" class="chnum" url="{$appkucun}?m=kcorder&a=pronum&ajax=1&order_id={$data.order_id}&productid={$p.productid}&num=1"  style="color:red">加数量</a>
        {/if}
        </div>
        </td>
    </tr>
    {/foreach}
  </table>
  
  <div class="h10"></div>
 
  
  <div class="kdtotalbox">
  		<div class="l">共<span id="total_num">{$data.total_num}</span>件</div>
        <div class="r">合计：￥<span id="gys_money">{$data.gys_money}</span>件</div>
  </div>
  <div class="kdcomment">备注：<span>{$data.comment}</span></div>
  <table class="table-addr">
  	<tr>
    	<td class="t1">姓名 </td>
        <td>{$data.nickname}</td>
    </tr>
    
    <tr>
    	<td class="t1">电话 </td>
        <td><a href="tel:{$data.telephone}">{$data.telephone}</a></td>
    </tr>
    
    <tr>
    	<td class="t1">地址 </td>
        <td>{$site.sitename}-{$data.address}</td>
    </tr>
    
  </table>
  
  <table class="table-addr">
  	
    <tr>
    	<td class="t2">订单编号 </td>
        <td>{$data.orderno}</td>
    </tr>
     
    <tr>
    	<td class="t2">下单时间 </td>
        <td>{$data.dateline|date:Y-m-d H:i:s}</td>
    </tr>
    
     <tr>
	<td class="t2">状态</td><td> {$order_status_list[$data.status]}   </td>
	 
</tr>
    
  </table>
  <div class="clearfix"></div>
  
  <!--订单操作-->
  <h1 class="index-hd">订单操作</h1>
  {if $data.status eq 0}
  <form method="post" action="{$appkucun}?m=kcorder&a=confirm" class="form form-inline ">
    <input type="hidden" name="order_id" value="{$data.order_id}" />
    <table class="table table-bordered">
      <tr>
        <td width="40"> 订单<br />
          确认 </td>
        <td><div class="input-row">
            <label>操作日志</label>
            <input type="text" name="content" value="{$admin.username}确认订单了" class="w98" />
          </div>
          <button type="submit" class="btn btn-row btn-success">确认下单</button></td>
      </tr>
    </table>
  </form>
  {/if}
  {if $data.status gt 1}
  <form method="post" action="{$appkucun}?m=kcorder&a=send" class="form form-inline ">
    <input type="hidden" name="order_id" value="{$data.order_id}" />
    <table class="table table-bordered">
      <tr>
        <td  width="40"> 修改<br />
          物流 </td>
        <td><div class="input-row">
            <label>联系电话</label>
            
            <input type="text" name="kdy_telephone" value="{if $data.kdy_telephone}{$data.kdy_telephone}{else}{$kucun.telephone}{/if}">
            <br>
          </div>
          <div class="input-row">
            <label>物流信息</label>
            <input type="text" name="shipping_info" value="{$data.shipping_info}" class="w98" />
          </div>
          <div class="input-row">
            <label>操作日志</label>
            <input type="text" name="content" value="{$admin.username}确认发货了" class="w98" />
          </div>
          <button type="submit" class="btn btn-row btn-success">确认修改</button></td>
      </tr>
    </table>
  </form>
  {/if}
  
  {if $data.status eq 1}
  <form method="post" action="{$appkucun}?m=kcorder&a=send" class="form form-inline ">
    <input type="hidden" name="order_id" value="{$data.order_id}" />
    <table class="table table-bordered">
      <tr>
        <td  width="40"> 确认<br />
          发货 </td>
        <td><div class="input-row">
            <label>联系电话</label>
            <input type="text" name="kdy_telephone" value="{$kucun.telephone}">
            <br>
          </div>
          <div class="input-row">
            <label>物流信息</label>
            <input type="text" name="shipping_info" value="{$data.shipping_info}" class="w98" />
          </div>
          <div class="input-row">
            <label>操作日志</label>
            <input type="text" name="content" value="{$admin.username}确认发货了" class="w98" />
          </div>
          <button type="submit" class="btn btn-row btn-success">确认发货</button></td>
      </tr>
    </table>
  </form>
  {/if}
  {if $data.status eq 2 && $data.isreceived eq 2}
  <form method="post" action="{$appkucun}?m=kcorder&a=finish" class="form form-inline " onsubmit="return confirm('订单确认完成后订单不能再编辑，确认完成吗？');">
    <input type="hidden" name="order_id" value="{$data.order_id}" />
    <table class="table table-bordered">
      <tr>
        <td width="40"> 订单<br />
          完成 </td>
        <td><div class="input-row">
            <label>操作日志</label>
            <input type="text" name="content" value="{$admin.username}确认完成了" class="w98" />
          </div>
          <button type="submit" class="btn btn-row btn-success">确认完成</button></td>
      </tr>
    </table>
  </form>
  {/if}
  {if $data.status eq 0}
  <form method="post" action="{$appkucun}?m=kcorder&a=cancel" class="form form-inline " onsubmit="return confirm('订单取消后不可恢复，并且会将订单金额返还给客户，确认取消吗？');">
    <input type="hidden" name="order_id" value="{$data.order_id}" />
    <table class="table table-bordered">
      <tr>
        <td  width="40"> 取消<br />
          订单 </td>
        <td><div class="input-row">
            <label>原因</label>
            <input type="text" name="message" value="" class="w98" />
          </div>
          <div class="input-row">
            <label>操作日志</label>
            <input type="text" name="content" value="{$admin.username}取消订单了" class="w98" />
          </div>
          <button type="submit" class="btn btn-row btn-success">订单取消</button></td>
      </tr>
    </table>
  </form>
  {/if}
  
  </div>
</div>
<script>
$(function(){
	$(".chnum").on("click",function(){
		var obj=$(this);
		$.get(obj.attr("url"),function(data){
			if(data.error){
				skyToast(data.message);
			}else{
				
				obj.parents("tr").find(".buy_num").html(data.data.buy_num); 
				$("#gys_money").html(data.data.gys_money);
				$("#total_num").html(data.data.total_num);

			}
		},"json");
	});
});
</script>
{assign var="botnav" value="kcorder"}
{include file="footer.html"}
</body>
</html>
